package pojo;

public class Hello {
    private String str;

    //无参构造
//    public Hello(){
//        System.out.println("Hello无参构造");
//    }
    //无参构造是隐式的，不存在的话会报错

    //有参构造 如果要用有参构造创建对象
    public Hello(String str){
        System.out.println("Hello有参构造"+str);
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }
    public void show(){
        System.out.println("str="+str);
    }
    @Override
    public String toString() {
        return "Hello{" +
                "str='" + str + '\'' +
                '}';
    }
}
